<!-- 权限编辑 -->
<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">
        <span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
    </button>
    <h4 class="modal-title" id="mod-title">{$meta_title}</h4>
</div>
<div class="modal-body" id="content">
    <form class="form-horizontal m-t" id="signupForm">
        <input type="hidden" name="admin_id" value="{$adminItem.admin_id}">
        <div class="form-group">
            <label class="col-sm-3 control-label">用户名:</label>
            <div class="col-sm-7">
                <label> <input type="text" name="admin_name" class="form-control" value="{$adminItem.admin_name}"></label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">密码:</label>
            <div class="col-sm-7">
                <label> <input type="text" name="admin_password" class="form-control" ></label>
                <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 只有填写了密码才修改，不填写不修改</span>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">角色:</label>
            <div class="col-sm-7">
                <select name="role_id" data-placeholder="选择角色..." class="form-control" tabindex="2">
                    {foreach($roleList as $key => $role_info)}
                    <option data-key="{$role_info.role_id}" {if($role_info.role_id== $adminItem.role_id)}selected{/if} value="{$role_info.role_id}" >{$role_info.role_name}</option>
                    {/foreach}
                </select>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">是否为超级管理员:</label>
            <div class="col-sm-7">
                <label>
                    <div class="radio i-checks">
                        <label><input type="radio" value="1" name="admin_is_super"{if($adminItem.admin_is_super == 1)} checked {/if} disabled> <i></i> 是</label>
                    </div>
                    <div class="radio i-checks">
                        <label><input type="radio" value="0" name="admin_is_super" {if($adminItem.admin_is_super == 0)} checked {/if} disabled > <i></i> 否</label>
                    </div>
                </label>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">绑定前台会员:</label>
            <div class="col-sm-6">
                <select name="member_id" data-placeholder="请选择前台会员..." class="chosen-select" data-no_results_text="未找到前台会员：">
                    <option value="0">请选择前台会员</option>
                    {foreach $memberList as $memberItem}
                    <option value="{$memberItem.member_id}" {if($memberItem.member_id == $adminItem.member_id)} selected {/if} >
                    {$memberItem.member_name} - {$memberItem.member_truename} - {$memberItem.member_mobile}
                    </option>
                    {/foreach}
                </select>
            </div>
        </div>
    </form>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
    <button type="button" class="btn btn-primary btn_save" data-dismiss="modal">快捷保存</button>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $('.i-checks').iCheck({
            checkboxClass: 'icheckbox_square-green',
            radioClass: 'iradio_square-green',
        });
        $(".btn_save").bind("click",function(){
            //  save
            $.ajax({
                url     :   "{:url('Admin/editAdmin')}",
                dataType:   "json",
                type    :   "post",
                data    :   $("#signupForm").serialize(),
                success :   function( obj ){
                    layer.msg(obj.msg,{
                        shift   :   3
                    },function(){
                        if( obj.code === 1){
                            $('#admin_list').bootstrapTable('refresh', null);
                        }
                    });
                }
            });
        });
        //  使用房间ID 检索房间信息
        $(".chosen-select").chosen({
            allow_single_de: true,
            width : "100%"
        })
    });
</script>